@import org.silkframework.runtime.plugin.PluginDescription
@import org.silkframework.workspace.Project

@(name: String,
opType: String,
pluginGroup: org.silkframework.runtime.plugin.PluginFactory[_],
project: Project)

@for(plugin <- pluginGroup.availablePlugins) {
  <div class="operator plugin">
    <div class="operator-index">
      @plugin.label
    </div>
    <div id="@{opType}_@{plugin.categories.head}_@{plugin.id}" class="draggable @name.toLowerCase">
      <small>@plugin.label</small>
      <p class="non-breaking-label">@plugin.label</p>
      @operatorExpanded(plugin)
    </div>
    <div class="mdl-tooltip mdl-tooltip--right" for="@{opType}_@{plugin.categories.head}_@{plugin.id}">
      @plugin.description
    </div>
  </div>
}

@operatorExpanded(plugin: PluginDescription[_]) = {
  @opType match {
    case "transform" => { @transformationBox(plugin.id, plugin, parameterValues(plugin), 0, 0, false, project) }
    case "compare" => { @comparisonBox(plugin.id, false, 1, 0.0, plugin, parameterValues(plugin), 0, 0, false, project) }
    case "aggregate" => { @aggregationBox(plugin.id, false, 1, plugin, parameterValues(plugin), 0, 0, false, project) }
  }
}

@parameterValues(plugin: PluginDescription[_]) = @{
  for(p <- plugin.parameters) yield p.defaultValue.getOrElse("").toString
}